
//fs.readFileSync(`${__dirname}/123.txt`)

const path = require('path');
const fs = require('fs');

//创建目录
// fs.mkdirSync(`${__dirname}/mydemo`);
// fs.mkdirSync(path.join(__dirname,'mydemo'));
console.log(path.join(__dirname,'mydemo'));  //d:\郑州\three\day05\作业\mydemo
console.log(path.join(__dirname,'mydemo','yesok'));//d:\郑州\three\day05\作业\mydemo\yesok
console.log(path.join(__dirname,'./mydemo','yesok'));//d:\郑州\three\day05\作业\mydemo\yesok
console.log(path.join(__dirname,'../mydemo','yesok'));//d:\郑州\three\day05\mydemo\yesok
console.log(path.join(__dirname,'/mydemo','yesok2'));  //d:\郑州\three\day05\作业\mydemo\yesok2


// let pathName = 'D:/郑州/three/day05/作业/1-内置url模块.js';
let pathName = 'D:/郑州/three/day05/作业/123.4.png';
let fname = path.basename(pathName);  //获取本地路径中的完整文件名
console.log(fname);
let extnames = path.extname(pathName);  //获取本地路径中文件的扩展名
console.log(extnames);
let pathObj = path.parse(pathName); //将本地路径解析成对象
console.log(pathObj,pathObj.name);

